<template>
  <div class="download">
    <!-- <img src="../assets/image/backgroud.png" alt="" />
    <div class="log">
      <img src="../assets/image/logo.png" alt="" />
    </div>
    <div class="txt">
      <img src="../assets/image/idear.png" alt="" />
    </div> -->
    <div class="box">
      <div class="btn" @click="isJump">立即下载</div>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    isJump() {
      let sUserAgent = navigator.userAgent.toLowerCase();

      var isIphone = sUserAgent.match(/iphone/i) == "iphone";
      var isHuawei = sUserAgent.match(/huawei/i) == "huawei";
      var isHonor = sUserAgent.match(/honor/i) == "honor";
      var isOppo = sUserAgent.match(/oppo/i) == "oppo";
      var isOppoR15 = sUserAgent.match(/pcam00/i) == "pcam00";
      var isVivo = sUserAgent.match(/vivo/i) == "vivo";
      var isXiaomi = sUserAgent.match(/xiaomi/i) == "xiaomi";
      var isXiaomi2s = sUserAgent.match(/mix\s/i) == "mix ";
      var isRedmi = sUserAgent.match(/redmi/i) == "redmi";
      var isSamsung = sUserAgent.match(/sm-/i) == "sm-";
      if (isIphone) {
        window.location.href =
          "https://apps.apple.com/cn/app/%E5%BF%83%E5%8A%A830%E7%A7%92-%E8%AF%AD%E9%9F%B3%E8%81%8A%E5%A4%A9%E4%BA%A4%E5%8F%8B%E5%B9%B3%E5%8F%B0/id1574849346";
        return "iphone";
      }
      // else if (isHuawei || isHonor) {
      //   // window.location.href =
      //   //   "https://appgallery.huawei.com/#/app/C104575683?sharePrepath=ag&locale=zh_CN&source=appshare&subsource=C104575683&shareTo=weixin&shareFrom=appmarket";
      //   window.location.href = "appmarket://details?id=com.xinyue.xd30seconds";
      //   return "huawei";
      // } else if (isOppo || isOppoR15) {
      //   window.location.href =
      //     "oppomarket://details?packagename=com.xinyue.xd30seconds";
      //   return "oppo";
      // } else if (isVivo) {
      //   // window.location.href =
      //   //   "https://h5coml.vivo.com.cn/h5coml/appdetail_h5/browser_v2/index.html?appId=3297437&resource=301&source=7";
      //   window.location.href = "vivomarket://details?id=com.xinyue.xd30seconds";
      //   return "vivo";
      // } else if (isXiaomi || isRedmi || isXiaomi2s) {
      //   window.location.href = "http://app.xiaomi.com/detail/1402133";
      //   // window.location.href = "mimarket://details?id=com.xinyue.xd30seconds";
      //   return "xiaomi";
      // } else if (isSamsung) {
      //   window.location.href =
      //     "https://static.psychexy.com/install/30s/30s_guanfang_v1.2.3.apk";
      //   return "samsung";
      // }
      else {
        window.location.href =
          "https://static.psychexy.com/install/temper/temperguanwang1.0.apk";
        return "default";
      }
    },
  },
};
</script>

<style lang="less" scoped>
.download {
  position: relative;
  height: 100%;
  width: 100%;
  min-height: 812px;
  background-size: cover;
  background-image: url(../assets/image/background.png);
  background-repeat: no-repeat;
  background-position: center 0;
  // background-attachment: fixed;
  .box {
    position: absolute;
    // left: 20%;
    bottom: 15%;
    width: 100%;
    text-align: center;
    .btn {
      display: inline-block;
      width: 240px;
      height: 64px;
      background-color: #ffe330;
      border-radius: 32px;
      text-align: center;
      line-height: 64px;
      color: #333333;
      font-size: 24px;
      font-weight: 800;
    }
  }
}
</style>